<form id="frmModal" name="frmModal" action="<?php echo site_url(array('psdm','karyawan','ajax','update')) ?>" method="post">
<h3 class="dialog_title"><span>Edit Karyawan</span></h3>

<div id="ginfo" style="width: 600px;">
<div class="dialog_content">
<div style="border-bottom: 1px solid #CCC; padding: 10px 0;">
<table width="100%" border="0" cellpadding="5">
	<tr>
		<td colspan="2">
		<h3 style="padding: 0; margin: 0">General Information</h3>
		</td>
	</tr>
	<tr>
		<td align="right">Kode karyawan:</td>
		<td>
			<input type="text" name="inp[0]" id="textfield" value="<?php echo $kary_id?>" disabled="disabled">
			<input type="hidden" name="inp[0]" id="textfield" value="<?php echo $kary_id?>">
		</td>
	</tr>
	<tr>
		<td align="right">Nama:</td>
		<td><input type="text" name="inp[1]" id="textfield2" value="<?php echo $kary_nama ?>" class="validate['required']"></td>
	</tr>
	<tr>
		<td align="right">Tempat lahir:</td>
		<td>
			<select name="inp[2]">
			<?php if ($kota_data->num_rows() > 0):?>
			<?php foreach($kota_data->result_array() as $row):?>
				<option value="<?php echo $row['kota_id']?>" <?php if ($row['kota_id']==$kary_tempat_lahir):?>selected="selected"<?php endif?> >
				<?php echo $row['kota_nama']?>
				</option>
			<?php endforeach?>
			<?php endif?>
			</select>
		</td>
	</tr>
	<tr>
		<td align="right">Tanggal lahir:</td>
		<td><input type="text" name="inp[3]" id="textfield4" value="<?php echo $kary_tgl_lahir ?>" class="datepicker validate['required']"></td>
	</tr>
	<tr>
		<td align="right">Jenis kelamin:</td>
		<td><label> <input type="radio" name="inp[4]" value="L" <?php if ($kary_jenis_kelamin=="L"):?>checked="checked"<?php endif?> class="validate['group[3]']"> Laki-laki</label> 
			<label style="margin-left: 10px"> <input type="radio" name="inp[4]" value="P" <?php if ($kary_jenis_kelamin=="P"):?>checked="checked"<?php endif?> class="validate['group[3]']"> Perempuan</label>
		</td>
	</tr>
	<tr>
		<td align="right">Golongan darah:</td>
		<td><label> <input type="radio" name="inp[5]" value="A" <?php if ($kary_golongan_darah=="A"):?>checked="checked"<?php endif?> class="validate['group[1]']"> A</label> 
			<label style="margin-left: 10px"> <input type="radio" name="inp[5]" value="B" <?php if ($kary_golongan_darah=="B"):?>checked="checked"<?php endif?> class="validate['group[1]']"> B</label> 
			<label style="margin-left: 10px"> <input type="radio" name="inp[5]" value="AB" <?php if ($kary_golongan_darah=="AB"):?>checked="checked"<?php endif?>class="validate['group[1]']"> AB</label> 
			<label style="margin-left: 10px"> <input type="radio" name="inp[5]" value="O" <?php if ($kary_golongan_darah=="O"):?>checked="checked"<?php endif?> class="validate['group[1]']"> O</label></td>
	</tr>
	<tr>
		<td align="right">Marital:</td>
		<td><label> <input type="radio" name="inp[6]" value="BL" <?php if ($kary_status_marital=="BL"):?>checked="checked"<?php endif?> class="validate['group[2]']">Belum Menikah</label> 
			<label style="margin-left: 10px"> <input type="radio" name="inp[6]" value="M" <?php if ($kary_status_marital=="M"):?>checked="checked"<?php endif?> class="validate['group[2]']"> Menikah</label> 
			<label style="margin-left: 10px"> <input type="radio" name="inp[6]" value="DJ" <?php if ($kary_status_marital=="DJ"):?>checked="checked"<?php endif?> class="validate['group[2]']"> Duda / Janda</label></td>
	</tr>
	<tr>
		<td align="right">Jumlah Tanggungan</td>
		<td><input type="text" name="inp[15]" value="<?php echo $kary_jml_tanggungan?>" style="width: 40px; text-align: right;" /></td>
	</tr>
	<tr>
		<td align="right">Agama:</td>
		<td><select name="inp[7]" id="select">
			<?php foreach($agama_options as $key=>$val):?>
				<option value="<?php echo $key?>" 
					<?php if ($kary_agama==$key):?>selected<?php endif?>>
					<?php echo $val?>
				</option>
			<?php endforeach?>
		</select></td>
	</tr>
	<tr>
		<td align="right">Email:</td>
		<td><input type="text" name="inp[8]" value="<?php echo $kary_email?>" class="validate['required','email']"></td>
	</tr>
	<tr>
		<td align="right">Tanggal masuk</td>
		<td><input type="text" name="inp[9]" value="<?php echo $kary_tgl_masuk?>" class="datepicker validate['required']"></td>
	</tr>
	<tr>
		<td align="right">Status kerja</td>
		<td><select name="inp[10]">
		<?php if ($sts_data->num_rows() > 0):?>
		<?php foreach($sts_data->result_array() as $row):?>
			<option value="<?php echo $row['kary_sts_id']?>" 
				<?php if ($kary_sts_id==$row['kary_sts_id']):?>selected<?php endif?>>
				<?php echo $row['kary_sts_nama']?>
			</option>
			<?php endforeach?>
			<?php endif?>
		</select></td>
	</tr>
</table>
</div>
<div class="dialog_buttons" style="padding: 12px 10px">
	<input class="button" type="submit" value="Next" /> 
	<input class="button" type="button" value="Cancel" onclick="FBModal_hide()" />
</div>
</div>
</div>


<div id="cinfo" style="width: 600px; display: none;">
<div class="dialog_content">
<div style="border-bottom: 1px solid #CCC; padding: 10px 0;">
<table width="100%" border="0" cellpadding="5">
	<tr>
		<td colspan="2">
		<h3 style="padding: 0; margin: 0">Contact Information</h3>
		</td>
	</tr>
	<tr>
		<td>Alamat</td>
		<td>Kota</td>
	</tr>
	<tbody id="cinfo_alamat">
		<?php foreach($alamat_data->result_array() as $row):?>
		<tr>
			<td><input type="text" style="width:400px" name="inp[11][record-<?php echo $row['kary_alm_id']?>][1]" value="<?php echo $row['kary_alm_alamat']?>" class="validate['required']" /></td>
			<td><select style="width:100%" name="inp[11][record-<?php echo $row['kary_alm_id']?>][2]">
				<?php foreach($kota_data->result_array() as $kota):?>
					<option value="<?php echo $kota['kota_id']?>" 
						<?php if (strtolower($kota['kota_nama'])==strtolower($row['kary_alm_kota'])):?> selected="selected"<?php endif?>>
						<?php echo $kota['kota_nama']?>
					</option>
				<?php endforeach?>
				</select>
			</td>
			<td><a class="fakeLink" 
				onclick="var tr = $(this).getParent('tr'); 
					var inp = tr.getElements('input');
					$('frmModal').retrieve('formCheck').dispose(inp[0]);
					$('frmModal').retrieve('formCheck').dispose(inp[1]);
					tr.destroy();	
					ajax(APP.base+'/ajax/deletePiecesAlamat/<?php echo $row['kary_alm_id']?>', 'post');	
				">delete</a></td>
		</tr>
		<?php endforeach?>
	</tbody>
	<tr>
		<td colspan="2" align="right"><a onclick="_addRowAlamat($(cinfo_alamat))" class="fakeLink">Tambah</a></td>
	</tr>
</table>
<table cellpadding="5">
	<tr>
		<td colspan="3">Telepon</td>,
	</tr>
	<tbody id="cinfo_tlp">
		<?php foreach($tlp_data->result_array() as $row):?>
		<?php $ss = explode("-",$row['kary_tlp_no'])?>
		<tr>
			<td><input type="text" style="width:40px" name="inp[12][record-<?php echo $row['kary_tlp_no']?>][1]" 
					value="<?php echo $ss[0]?>" disabled="disabled" /></td>
			<td>-</td>
			<td><input type="text" style="width:105px" name="inp[12][record-<?php echo $row['kary_tlp_no']?>][2]" 
					value="<?php echo $ss[1]?>" disabled="disabled" /></td>
			<td><a class="fakeLink" onclick="
					var tr = $(this).getParent('tr'); 
					var inp = tr.getElements('input');
					$('frmModal').retrieve('formCheck').dispose(inp[0]);
					$('frmModal').retrieve('formCheck').dispose(inp[1]);
					tr.destroy();	
					ajax(APP.base+'/ajax/deletePiecesTlp/<?php echo $row['kary_tlp_no']?>', 'post');
				">delete</a></td>
		</tr>
		<?php endforeach?>
	</tbody>
	<tr>
		<td colspan="3" align="right"><a onclick="_addRowTlp($(cinfo_tlp))" class="fakeLink">Tambah</a></td>
		<td></td>
	</tr>
</table>
</div>
<div class="dialog_buttons" style="padding: 12px 10px">
	<input class="button" type="submit" value="Save" /> 
	<input class="button" type="button" value="Cancel" onclick="FBModal_hide()" />
</div>
</div>
</div>

</form>
